package world.ztomorrow.search.controller;


import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import world.ztomorrow.common.dto.PageRespDto;
import world.ztomorrow.common.dto.RestResp;
import world.ztomorrow.search.dto.req.BookSearchReqDto;
import world.ztomorrow.search.dto.resp.BookInfoRespDto;
import world.ztomorrow.search.service.SearchService;

import java.io.IOException;

@RestController
@RequestMapping("/front/search")
@RequiredArgsConstructor
public class SearchController {

    private final SearchService searchService;

    /**
     * 小说搜索接口
     */
    @GetMapping("/books")
    public RestResp<PageRespDto<BookInfoRespDto>> searchBooks(BookSearchReqDto condition) throws IOException {
        return searchService.searchBooks(condition);
    }

}